package com.freelancer.musicinstruction.tasks;

import android.util.Log;

import com.freelancer.musicinstruction.activity.interfaces.ServiceInvokable;

public abstract class ServiceInvokableTask<T extends ServiceInvokable > extends LoadableTask<T> {
	
	private static final String TAG = ServiceInvokableTask.class.getSimpleName();
	
	public ServiceInvokableTask( T activity ){
		super( activity );
	}

	@Override
	public void doActualTask() {
		
		try{
			doRunService();
		}
		catch( Exception e ){
			Log.e(TAG, Log.getStackTraceString( e ));
			activity.onServiceCallFailed();
		}
	}
	
	protected abstract void doRunService();
}
